package com.fowo.api.common.model;


import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldNameConstants;

@Getter
@Setter
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
@Builder
@NoArgsConstructor
@FieldNameConstants
public  class JoinResult {
    private boolean success;
    private Object val;

    public JoinResult(boolean success, Object val) {
        this.success = success;
        this.val = val;
    }

    /**
     * 返回错误结果
     */
    public static JoinResult fail() {
        return fail(null);
    }

    public static JoinResult fail(Object data) {
        return new JoinResult(false, data);
    }
    /**
     * 返回成功结果
     */
    public static JoinResult success() {
        return success(null);
    }

    public static JoinResult success(Object data) {
        return new JoinResult(true, data);
    }

}